﻿#region Header
// ------------------------ Licence / Copyright ------------------------
// 
// ScrumTable for Scrum Meeting Support
// Copyright © HSR - Hochschule für Technik Rapperswil
// All Rights Reserved
// 
// Author:
//  Michael Gfeller Silvan Gehrig Patrick Boos
// 
// ---------------------------------------------------------------------
#endregion

#region Usings

using System;

#endregion

namespace ScrumTable.BL.DM.DataManagement
{

    /// <summary>
    /// Specifies the reason of a field error. This reason is provided
    /// by the validation of the back-end system.
    /// </summary>
    public enum DomainSyncErrorReason
    {
        /// <summary>
        /// The error source could not be recognized.
        /// </summary>
        Unknown = 0,

        /// <summary>
        /// A field is empty but the back-end system requires a value.
        /// </summary>
        Empty,

        /// <summary>
        /// A field has content but the back-end system doesn't allow a field value.
        /// </summary>
        NotEmpty,

        /// <summary>
        /// The provided field value is too long for a field.
        /// </summary>
        TooLong
    }


    /// <summary>
    /// This class contains the save error information provided by the underlying
    /// data driver occurred during the save procedure.
    /// </summary>
    public class DomainSyncErrorInfo
    {
        #region Declarations
        //--------------------------------------------------------------------
        // Declarations
        //--------------------------------------------------------------------

        #endregion

        #region Properties
        //--------------------------------------------------------------------
        // Properties
        //--------------------------------------------------------------------

        /// <summary>
        /// Gets the name of the back-end field which has caused the error.
        /// </summary>
        public DomainMeta Field { get; internal set; }

        /// <summary>
        /// Gets the name of the back-end field which has caused the error.
        /// </summary>
        public string FieldMappedName { get; internal set; }

        /// <summary>
        /// Gets a human readable name of the back-end field which has caused the error.
        /// </summary>
        public string FieldDisplayName { get; internal set; }

        /// <summary>
        /// Gets the reason of a field error.
        /// </summary>
        public DomainSyncErrorReason FieldErrorReason { get; internal set; }

        /// <summary>
        /// Gets the fields original value.
        /// </summary>
        public object OriginalValue { get; internal set; }

        /// <summary>
        /// Gets the field value.
        /// </summary>
        public object Value { get; internal set; }

        /// <summary>
        /// Gets the exception which has caused the error.
        /// </summary>
        public Exception Error { get; internal set; }

        #endregion

        #region Constructors / Destructor
        //--------------------------------------------------------------------
        // Constructors / Destructor
        //--------------------------------------------------------------------

        /// <summary>
        /// Initializes a new instance of the <see cref="DomainSyncErrorInfo"/> class.
        /// </summary>
        internal DomainSyncErrorInfo()
        {
        }

        #endregion

        #region Methods
        //--------------------------------------------------------------------
        // Methods
        //--------------------------------------------------------------------

        #endregion

        #region Events
        //--------------------------------------------------------------------
        // Events
        //--------------------------------------------------------------------
        #endregion

    }
}